package com.qqtech.qquan.sms.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.model.PageKit;
import com.qqtech.core.frame.model.PageOrder;
import com.qqtech.core.frame.service.BaseServiceImpl;
import com.qqtech.qquan.sms.dao.SmsProviderDao;
import com.qqtech.qquan.sms.enums.SmsProviderStatusDictEnum;
import com.qqtech.qquan.sms.model.SmsProvider;

@Service
public class SmsProviderServiceImpl extends BaseServiceImpl<SmsProvider>implements SmsProviderService {
	public static final Logger log = LoggerFactory.getLogger(SmsProviderServiceImpl.class);

	@Resource
	private SmsProviderDao smsProviderDao;

	@Override
	protected BaseDao<SmsProvider> getBaseDao() {
		return smsProviderDao;
	}

	@Override
	public List<SmsProvider> queryAllProviderByPriorityAsc() {
		SmsProvider smsProvider = new SmsProvider();
		smsProvider.setStatus(SmsProviderStatusDictEnum.OK.getCode());
		List<SmsProvider> spList = smsProviderDao.queryList(smsProvider,
				new PageKit(new PageOrder(Direction.ASC, "priority")));
		return spList;
	}

}